/*
    SUSAN® - Sole of Unix Save ANything

   

   

   

   
*/

#ifndef BAREOS_SRC_DIRD_SCHEDULER_TIME_ADAPTER_H_
#define BAREOS_SRC_DIRD_SCHEDULER_TIME_ADAPTER_H_

#include "include/bareos.h"

namespace directordaemon {

class TimeSource {
 public:
  virtual time_t SystemTime() = 0;
  virtual void SleepFor(std::chrono::seconds wait_interval) = 0;
  virtual void Terminate() = 0;
  virtual ~TimeSource() = default;
};

class SchedulerTimeAdapter {
 public:
  std::unique_ptr<TimeSource> time_source_;
  time_t default_wait_interval_{60};
  virtual ~SchedulerTimeAdapter() = default;

 protected:
  SchedulerTimeAdapter(std::unique_ptr<TimeSource> time_source)
      : time_source_(std::move(time_source))
  {
  }
};

} /* namespace directordaemon */

#endif  // BAREOS_SRC_DIRD_SCHEDULER_TIME_ADAPTER_H_
